#include <iostream>
#include <vector>
#include <string>

using namespace std;

int evalRPN(vector<string> &tokens)
{
    vector<int> st;
    int i = 0;
    while (i < tokens.size())
    {
        int r = 0;
        if (tokens[i] == "+")
        {
            r = *(st.end() - 2) + *(st.end() - 1);
            st.pop_back(); st.pop_back();
            st.push_back(r);
        }else if (tokens[i] == "-")
        {
            r = *(st.end() - 2) - *(st.end() - 1);
            st.pop_back(); st.pop_back();
            st.push_back(r);
        }else if (tokens[i] == "*")
        {
            r = *(st.end() - 2) * *(st.end() - 1);
            st.pop_back(); st.pop_back();
            st.push_back(r);
        }else if (tokens[i] == "/")
        {
            r = *(st.end() - 2) / *(st.end() - 1);
            st.pop_back(); st.pop_back();
            st.push_back(r);
        }else{
            st.push_back(stoi(tokens[i]));
        }
        i++;
    }
    return st[0];
}

int main()
{
    vector<string> tokens = {"4","13","5","/","+"};
    cout << evalRPN(tokens) << endl;
    return 0;
}
